package com.asnike.P.bejeweled{
	public class GameModel{
		
		static public var TOTAL_JEWEL_TYPE:int = 6;
		static internal var JEWEL_EMPTY:int = -1;
		
		private var _jewelMap:Array = [];
		private var _jewelSize:Array = [];
		private var _selectedJewels:Array = [];
		
		internal var jewelRemoveDuration:Number = .25;
		internal var jewelShiftDuration:Number = .4;
		internal var jewelSelectEffect:Object = {color:0x87f1ff, alpha:.9, blurX:3, blurY:3, strength:8, quality:3};
		
		public function GameModel(){
			
		}
		
		internal function getJewelMap():Array{
			return _jewelMap;
		}
		
		internal function setJewelSize( $width:int, $height:int ):void{
			var i:int, j:int, result:Array;
			
			_jewelSize[0] = $width;
			_jewelSize[1] = $height;
			
			_jewelMap = [];
			for( j = 0 ; j < _jewelSize[1] ; ++j ){
				_jewelMap[j] = [];
				for( i = 0 ; i < _jewelSize[0] ; ++i ){
					_jewelMap[j][i] = getJewelType();
				}
			}
		}
		private function getJewelType():int{
			return int( Math.random()*TOTAL_JEWEL_TYPE );
		}
		
		internal function selectJewel( $jewel:Jewel ):void{
			_selectedJewels[_selectedJewels.length] = $jewel;
		}
		internal function getSelectedJewels():Array{
			return _selectedJewels;
		}
		
		internal function getJewelSize():Array{
			return _jewelSize;
		}
		
		internal function getMapLength():int{
			return _jewelMap.length*_jewelMap[0].length;
		}
	}
}